package example.pages;

import net.thucydides.core.annotations.DefaultUrl;
import net.thucydides.core.annotations.findby.FindBy;
import net.thucydides.core.pages.PageObject;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

@DefaultUrl("http://clickandflirt.com/search")
public class HomePage extends PageObject
{

	@FindBy(xpath = ".//*[@id='userNav']")
	private WebElement blockUserMenu;
	@FindBy(xpath = "//a[contains(@href,'logout')]")
	private WebElement linkLogout;

	public HomePage(WebDriver driver)
	{
		super(driver);
	}

	public boolean is_user_menu_present()
	{
		return element(blockUserMenu).isCurrentlyVisible();
	}

	public void click_on_link_logout()
	{
		linkLogout.click();
	}

	public void open_user_menu()
	{
		blockUserMenu.click();
	}

	public void logout()
	{
		open_user_menu();
		linkLogout.click();
	}
}